﻿using System.Collections.Generic;
using Xunit;
using YAPL.Language.Ast;

namespace YAPL.Test.YAPL.Language.Ast {

	public class FunctionCallExpressionTest {
		[Fact]
		public void NodeEqualsShouldWorkCorrectly() {
			var exprList1 = new List<Expression>();
			var exprList2 = new List<Expression>();
			var exprList3 = new List<Expression>();

			exprList1.Add(Expressions.Variable("a"));
			exprList1.Add(Expressions.Variable("b"));

			exprList2.Add(Expressions.Variable("b"));

			exprList3.Add(Expressions.Variable("b"));
			exprList3.Add(Expressions.Variable("c"));

			var call1 = Expressions.FunctionCall("func1", exprList1);
			var call2 = Expressions.FunctionCall("func2", exprList2);
			var call3 = Expressions.FunctionCall("func1", exprList3);

			Assert.False(call1.NodeEquals(null));
			Assert.False(call1.NodeEquals(Expressions.Variable("a")));
			Assert.False(call1.NodeEquals(call2));
			Assert.True(call1.NodeEquals(call1));
			Assert.True(call1.NodeEquals(call3));
		}
	}
}
